package com.shop.cereshop.admin.service.stat.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cereshop.admin.dao.buyer.CereBuyerUserDAO;
import com.shop.cereshop.admin.dao.stat.CereDashboardStatsDAO;
import com.shop.cereshop.admin.page.index.GlobalStatsVO;
import com.shop.cereshop.admin.page.index.RegionStatsVO;
import com.shop.cereshop.admin.param.stat.StatsParams;
import com.shop.cereshop.admin.service.stat.CereDashboardStatsService;
import com.shop.cereshop.commons.domain.stat.CereDashboardStats;
import com.shop.cereshop.commons.utils.TimeUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

@Service
@RequiredArgsConstructor
public class CereDashboardStatsServiceImpl extends ServiceImpl<CereDashboardStatsDAO, CereDashboardStats> implements CereDashboardStatsService {
    private final CereDashboardStatsDAO cereDashboardStatsDAO;
    private final RedisTemplate redisTemplate;
    private final CereBuyerUserDAO cereBuyerUserDAO;

    @Override
    public RegionStatsVO viewStats(StatsParams params) {
        //根据区域参数查询全国或者省份所有用户和商家数量
        if (params.getProvince() == null) {
            //查询全国所有用户和商家数量
            //先拿到当前时间
            LocalDate now = LocalDate.now();
            //拿到今年的第一天时间
            LocalDate firstDayOfYear = now.withDayOfYear(1);
        }

        return null;
    }

    public RegionStatsVO viewGlobalStats() {
        return null;
     }
}
